package us.nchu.tomtiger.rowMapper;

import org.springframework.jdbc.core.RowMapper;
import us.nchu.tomtiger.model.Project;
import us.nchu.tomtiger.model.User;

import java.sql.ResultSet;
import java.sql.SQLException;

/**
 * Created by XiongXuan on 2018/1/8.
 */
public class ProjectRowMapper implements RowMapper<Project> {

    @Override
    public Project mapRow(ResultSet resultSet, int i) throws SQLException {
        Project project = new Project();

        project.setId(resultSet.getInt("id"));
        project.setPhoneNumber(resultSet.getString("owner"));
        project.setStatus(resultSet.getInt("status"));
        project.setName(resultSet.getString("name"));
        project.setType(resultSet.getInt("type"));
        project.setField(resultSet.getString("field"));
        project.setContactType(resultSet.getInt("contact_type"));
        project.setContact(resultSet.getString("contact"));
        project.setIntro(resultSet.getString("intro"));

        return project;
    }
}
